package com.bw.packcar.adapter


import com.bw.packcar.model.PackEntity
import com.bw.packcar.R
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class PackAdapter : BaseMultiItemQuickAdapter<PackEntity, BaseViewHolder>() {

    init {
        addItemType(0, R.layout.item_car_pack_k)
        addItemType(1, R.layout.item_car_pack_z)
        addItemType(2, R.layout.item_car_pack_w)
    }

    override fun convert(holder: BaseViewHolder, item: PackEntity) {


        holder.setText(R.id.tv_title, item.spaceNumber)
        holder.setText(R.id.tv_name, item.areaName)
        holder.setText(R.id.tv_type, item.spaceType)

        if (item.itemType == 1) {
            holder.setText(R.id.tv_user, item.userName)
            holder.setText(R.id.tv_car_code, item.licensePlate)
        } else if (item.itemType == 2) {
            holder.setText(R.id.tv_remark, item.remarks)
        }

    }
}